#!/bin/sh
##
##  Copyright (C) 1998-2007 J. Andrew McLaughlin
## 
##  api2html.sh
##

# This is used against the kernel API header file, as well as the VSH
# and window library header files, to generate a simple formatted HTML
# listing of the function declarations with their descriptions

if [ $# != 1 ] ; then
	echo "Usage: $0 <filename>"
	exit 1
fi

echo '<html><head>'
sed -n \
	-e 's|[ ]*\/\/[ ]*TITLE[ ]*: \(.*\)|<title>\1</title>|p'\
	$1
echo '</head><body>'

sed -n \
	-e 's|static inline ||'\
	-e 's|[ 	]*_X_ \(.*\)|<p class="function">\1</p>|p'\
	-e 's|[ ]*\/\/[ ]*Desc[ ]*: \(.*\)|<blockquote><p>\1</p></blockquote>|p'\
	-e 's|[ ]*\/\/[ ]*CHAPTER[ ]*: \(.*\)|<h3>\1</h3>|p'\
	-e 's|[ ]*\/\/[ ]*TITLE[ ]*: \(.*\)|<h1>\1</h1>|p'\
	-e 's|[ ]*\/\/[ ]*PARA[ ]*: \(.*\)|<p>\1</p>|p'\
	$1

echo '</body></html>'